﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StockTrading.Model
{
    public class Order
    {
        public enum OrderType
        {
            Sell = 1,
            Buy = 0
        }
        [Column("id")]
        [Required]
        public int Id { get; set; }
        [Required]
        [Column("create_date")]
        public DateTime CreateDate { get; set; }
        [Column("user_id")]
        [Required]
        public int UserId { get; set; }
        public User User { get; set; }
        
        [Column("stock_id")]
        [Required]
        public int StockId { get; set; }
        public Stock Stock { get; set; }

        [Column("type",TypeName ="tinyint")]
        [Required]
        public OrderType Type { get; set; }
        
        [Column("price")]
        [Required]
        public double Price { get; set; }


        [Column("undealed")]
        [Required]
        public double Undealed { get; set; }

        [Column("dealed")]
        [Required]
        public double Dealed { get; set; }

        [Required]
        [Column("canceled")]
        public double Canceled { get; set; }

        public List<Transaction> SellTransactionsList { get; set; }
        public List<Transaction> BuyTransactionsList { get; set; }

    }
}
